﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Application.GatewayApp.Dto.Input
{
    /// <summary>
    /// 银行卡绑定，付款申请输入
    /// </summary>
    public class BankCardBindPayApplyInput
    {
        /// <summary>
        /// 申请Id
        /// </summary>
        [Required]
        [MaxLength(64)]
        public string ApplyId { get; set; }

        /// <summary>
        /// 银行编号
        /// </summary>
        [Required]
        [MaxLength(20)]
        public string BankNo { get; set; }

        /// <summary>
        /// 卡号或账号
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string AccountNo { get; set; }

        /// <summary>
        /// 户名
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string AccountName { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [Required]
        [MaxLength(30)]
        public string IdentityNo { get; set; }

        /// <summary>
        /// 账户类型(借记或贷记,常量组 = 1)
        /// </summary>
        public int AccountType { get; set; }

        /// <summary>
        /// 开户行名称
        /// </summary>
        [MaxLength(50)]
        public string OpenBankName { get; set; }

        /// <summary>
        /// 开户行省份
        /// </summary>
        [MaxLength(50)]
        public string OpenBankProvince { get; set; }

        /// <summary>
        /// 开户行所在城市
        /// </summary>
        [MaxLength(20)]
        public string OpenBankCity { get; set; }

        /// <summary>
        /// 预留手机号
        /// </summary>
        [Required]
        [MaxLength(20)]
        public string MobilePhone { get; set; }

        /// <summary>
        /// 信用卡有效期
        /// </summary>
        [MaxLength(20)]
        public string CreditCardLastTerm { get; set; }

        /// <summary>
        /// 信用卡尾号
        /// </summary>
        [MaxLength(20)]
        public string CreditCardLastNo { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public void TrimString()
        {
            if (this.ApplyId != null)
            {
                this.ApplyId = this.ApplyId.Trim();
            }
            if (this.AccountName != null)
            {
                this.AccountName = this.AccountName.Trim();
            }
            if (this.AccountNo != null)
            {
                this.AccountNo = this.AccountNo.Trim();
            }
            if (this.MobilePhone != null)
            {
                this.MobilePhone = this.MobilePhone.Trim();
            }
            if (this.IdentityNo != null)
            {
                this.IdentityNo = this.IdentityNo.Trim();
            }
        }
    }
}
